package cc.higou.service;

import cc.higou.core.dao.SkuMapper;
import cc.higou.core.pojo.Sku;
import cc.higou.core.pojo.SuperPojo;
import com.github.abel533.entity.Example;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("skuService")
@Transactional
public class SkuServiceImpl implements SkuService {

    private static final Logger LOGGER = LoggerFactory.getLogger(SkuServiceImpl.class);
    @Autowired
    private SkuMapper skuMapper;

    @Override
    public List<SuperPojo> findSkuByProductId(Long productId) {
        LOGGER.info("SkuServiceImpl类中的findSkuByProductId方法执行了");
        if (productId != null) {
            List<SuperPojo> skus = skuMapper.findSkuByProductId(productId);
            return skus;
        }
        return null;
    }

    @Override
    public Integer update(Sku sku) {
        int i = skuMapper.updateByPrimaryKeySelective(sku);
        return i;
    }
}
